# 作者：lian
import os

def use_rename():
    os.rename('file3','file4')

def use_dir_func():
    file_list = os.listdir('.')
    print(file_list)
    os.mkdir('dir2')
    os.rmdir('dir1')

def change_dir():
    print(os.getcwd())
    os.chdir('dir2')
    print(os.getcwd())


def scan_dir(current_path,width):
    file_list=os.listdir(current_path)
    for file in file_list:
        print(' '*width,file)
        new_path = current_path + '/' + file
        if os.path.isdir(new_path):
            scan_dir(new_path,width+4)



def read_conf():
    file = open('file6','r+',encoding='utf8')
    text_info = file.read()
    print(eval(text_info))
    file.close()

def use_stat(file_path):
    os.stat()

if __name__ == '__main__':
    #change_dir()
    #read_conf()
    #print(os.mkdir('dir4'))
    #os.rmdir('dir4')
    #os.getcwd()
    file_info = os.stat('file.txt')
    print('size{},uid{},mode{:x},mtime{}'.format(file_info.st_size, file_info.st_uid, \ file_info.st_mode,file_info.st_mtime))
    from time import strftime
    from time import gmtime
    print(strftime("%Y-%m-%d %H:%M:%S", gmtime(file_info.st_mtime)))






